package xin.marcher.module.price.remote;

import org.apache.dubbo.config.annotation.DubboReference;
import org.springframework.stereotype.Component;
import xin.marcher.module.common.core.JsonResult;
import xin.marcher.module.common.exception.BaseBizException;
import xin.marcher.module.construction.api.AuditApi;
import xin.marcher.module.construction.domain.request.FullDraftDataRequest;

/**
 * 审核API
 */
@Component
public class AuditRemote {

    @DubboReference(version = "1.0.0")
    private AuditApi auditApi;

    /**
     * 更新价格保存草稿
     *
     * @param request
     * @return
     */
    public Boolean saveDraft(FullDraftDataRequest request) {
        JsonResult<Boolean> result = auditApi.saveDraft(request);
        if (!result.getSuccess()) {
            throw new BaseBizException(result.getErrorMessage(), result.getErrorCode());
        }
        return result.getData();
    }

}
